package com.jash.labor.controller;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jash.labor.entity.Company;
import com.jash.labor.service.CompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.management.Query;
@Api(tags = "劳务公司相关接口")
@RestController
@RequestMapping(value = "/company" , produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class CompanyController {

    @Resource
    private CompanyService companyService;
    @ApiOperation(value = "添加信息接口")
    @ApiImplicitParams(
            {

                    @ApiImplicitParam(name = "company",value = "添加数据")
            }
    )
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public Object add(@RequestBody Company company){
        return companyService.add(company);
    }
    @ApiOperation(value = "修改信息接口")
    @ApiImplicitParams(
            {

                    @ApiImplicitParam(name = "company",value = "修改信息")
            }
    )

    @RequestMapping(value = "/edit",method = RequestMethod.POST)
    public Object edit(@RequestBody Company company){
        return companyService.edit(company);
    }
    @ApiOperation(value = "分页查询接口")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "pageNo",value = "第几页"),
                    @ApiImplicitParam(name = "pageSize",value = "一页多少条")
            }
    )

    @RequestMapping(value = "/queryListPage",method = RequestMethod.POST)
    public Object queryListPage(
           // @RequestParam(value = "companyid") Integer companyid,
            @RequestParam(value = "pageNo") Integer pageNo,
            @RequestParam(value = "pageSize" ,required = false,defaultValue = "10") Integer pageSize
    ){
        return companyService.queryListPage(pageNo, pageSize);
    }

    @ApiOperation(value = "查询劳务公司信息列表接口")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "companyid", value = "劳务公司ID"),
                    @ApiImplicitParam(name = "pageNo", value = "第几页"),
                    @ApiImplicitParam(name = "pageSize", value = "每页显示条数")
            }
    )
    /*
    查询劳务公司信息表
     */
    @RequestMapping(value = "/queryCompanyList",method = RequestMethod.POST)
    public Object cList(
            @RequestParam("Companyid") String Companyid,
            @RequestParam(value = "pageNo",required = false,defaultValue = "10") Integer pageNo,
            @RequestParam(value = "pageSize",required = false,defaultValue = "10") Integer pageSize
    ){
        return companyService.queryCompanyList(Companyid,pageNo,pageSize);

    }
    @ApiOperation(value = "查询公司列表接口")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "companyid",value = "劳务公司id"),
                    @ApiImplicitParam(name = "pageNo",value = "第几页"),
                    @ApiImplicitParam(name = "pageSize",value = "每页多少条")
            }
    )
//查询用工单位列表
    @RequestMapping(value = "/queryFirstPartylist",method = RequestMethod.POST)
    public Object queryFirstPartylist(
            @RequestParam("companyid") Integer companyid,
            @RequestParam(value = "pageNo",required = false) Integer pageNo,
            @RequestParam(value = "pageSize" ,required = false,defaultValue = "10") Integer pageSize
    ){
        return companyService.queryFirstPartylist(companyid,pageNo, pageSize);
    }
    @RequestMapping("/companyQueryStationList")
    public Object companyQueryStationList(
            @RequestParam("content") String content,
            @RequestParam("pageNo") Integer pageNo,
            @RequestParam(value = "pageSize",required = false,defaultValue = "10") Integer pageSize
    ){
        return companyService.companyQueryStationList(content,pageNo,pageSize);
    }
}
